<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<title>大卫杜夫 | 雪茄</title>
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<link rel="shortcut icon" type="image/ico" href="http://davidoff.com/favicon.ico" />
	<link href="../static/lib/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet">
	<link href="../static/css/main.css" rel="stylesheet">
	<link href="../static/css/en.css" rel="stylesheet">
</head>

<body>
	<div id="header"></div>

	
		<div id="kv_wp"></div>
		<script id="kv_tpl" type="text/html">
		<div class="top-banner">
				<section class="kv">
					<a href="javascript:void(0)">	
						<div style="background-image:url(<%:=kv%>)">&nbsp;</div></a>
				</section>
			</div>
		</script>
		
	<section class="secondary-nav mini">
		<div class="secondary-nav-wrapper show" id="type_wp">
			<script id="type_tpl" type="text/html">			

				<ul id="secondary-nav-list">
					<%for(var i = 0; i < cateList.length; i++) {%>
						<%if(curCate==cateList[i].label || (!curCate && i==0)) {%>
				<li class="half active" >
						<%}else {%>
							<li class="half">
						<%}%>
					<a href="javascript:void(0)"  onclick="showprd('<%:=cateList[i].id%>','<%:=cateList[i].label%>',this)"><%:=cateList[i].label%></a></li>
				<%}%>
			</ul>
		</script>
		</div>
	</section>

	<div class="cigars_detailbox ">
		<div class="page_wrapper">
			<div id="wp">
			</div>
			<script id="tpl" type="text/html">
				<section class="row acce_itemsbox">
					<%for(var i = 0; i < list.length; i++) {%>
					<a class="item col-sm-12 col-md-6 col-lg-6 col-xl-6" href="detail.html?PRODUCT_ID=<%:=list[i].PRODUCT_ID%>">
							<img src="<%:=JSON.parse(list[i].IMG_URL)[0]%>">
					<h2 class="title"><%:=list[i].PRODUCT_NAME%></h2>
					<!-- <p><%:=list[i].PRODUCT_REMARK%></p> -->
					<%if(list[i].IS_NEW==1){%>
					<div class="icon_new"></div>
					<%}%>
				</a>
				<%}%>
			</section>
			</script>
		</div>
		<!--footer start  -->
		<div id="footer"></div>
		<!--footer end  -->
		<script type="text/javascript" src="../static/lib/fancyBox-2.1.5/lib/jquery-1.10.1.min.js"></script>
		<script src="../static/lib/bootstrap/dist/js/bootstrap.min.js"></script>
		<script src="../static/js/common.js"></script>
		<script src="../static/js/template.js"></script>
		<script>
			var ProductList = []

			function showprd(id, lable, obj) {
				if (obj) {
					$(obj).parents("li").addClass('active').siblings().removeClass('active');
				}
				/*===产品列表====*/
				let prdParams = {
					"cmd": "product.list.get",
					"param": {
						"KEY_WORD": lable,
						"PAGE_INDEX": 1,
						"PAGE_SIZE": 1000
					}
				}
				$.ajax({
					type: "POST",
					url: "http://davidoff.gemdesign.cn/CMS/api/CMS",
					contentType: "application/json; charset=utf-8",
					data: JSON.stringify(prdParams),
					dataType: "json",
					success: function (data) {
						ProductList = data.ProductList
						var tpl = document.getElementById('tpl').innerHTML;
						var html = template(tpl, {
							list: ProductList
						});
						document.getElementById('wp').innerHTML = html;
						var kv;
						if(ProductList.length>0){
							kv=ProductList[0].KV_IMG_URL
						}
						var kvtpl = document.getElementById('kv_tpl').innerHTML;
						var html = template(kvtpl, {
							kv: kv
						});
						document.getElementById('kv_wp').innerHTML = html;
					},
					error: function (message) {
						alert(message)
					}
				});
			}
			$(function () {
				/*====获取配件的分类 start====*/
				$.post("http://davidoff.gemdesign.cn/CMS/api/CMS", {
					"cmd": "product.type.list.get"
				}, function (data) {
					ProductTypeList = data.ProductTypeList.find(function (elem) {
						return elem.label == '配件'
					});
					var keyword = getUrlParam('PD_TYPE_NAME');
					if (!keyword) {
						keyword = ProductTypeList.children[0].label
					}
					showprd(ProductTypeList.children[0].id, keyword);
					var tpl = document.getElementById('type_tpl').innerHTML;
					var html = template(tpl, {
						cateList: ProductTypeList.children,curCate:keyword
					});
					document.getElementById('type_wp').innerHTML = html;
				});

				/*====获取配件的分类 end====*/
			})

		</script>
</body>

</html>
